package com.fr.view;

import com.fr.base.FRContext;
import com.fr.base.Inter;
import com.fr.base.dav.LocalEnv;
import com.fr.cell.GUIUtils;
import com.fr.cell.core.layout.LayoutFactory;
import com.fr.report.WorkBook;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class PreviewFrame extends JFrame
{
  private PreviewPane previewPane;

  public PreviewFrame()
  {
    super(Inter.getLocText("PrintP-Print_Preview"));
    init();
    JPanel localJPanel = new JPanel();
    setContentPane(localJPanel);
    localJPanel.setLayout(LayoutFactory.createBorderLayout());
    this.previewPane = new PreviewPane();
    localJPanel.add(this.previewPane, "Center");
    setDefaultCloseOperation(2);
    setSize(800, 600);
    GUIUtils.centerWindow(this);
  }

  public void print(WorkBook paramWorkBook)
  {
    this.previewPane.print(paramWorkBook);
  }

  public void init()
  {
    if (FRContext.getCurrentEnv() == null)
      FRContext.setCurrentEnv(new LocalEnv(null));
  }
}